<template>
  <div>
    <p>商品列表页</p>
    <ul>
      <li v-for="(item, index) in iphones" :key="index">
          <router-link :to="'/detali/'+item.id">{{item.name}}</router-link>
            <button @click="asn(item.id)">哈哈哈</button>
      </li>
    
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      iphones: [
        { name: "iphones12 pro max", price: 9999 ,id:'1'},
        { name: "iphones12 pro", price: 8999 ,id:'2'},
        { name: "iphones12 ", price: 7999 ,id:'3'},
        { name: "iphones12 mini", price: 6999,id:'4' },
      ],
    };
  },
  methods:{
      asn(ss){
  this.$router.push(`/detali/${ss}`)     
      }
   
  }
};


</script>

<style>
</style>